<template>
  <view class="navbar">
    <u-navbar placeholder autoBack :autoBack="true" leftIcon="arrow-leftward">
      <!-- <view slot="center" style="flex-grow: 1; margin-left: 80rpx">
        <u-search
          placeholder="搜索"
          @custom="custom"
          :showAction="false"
          v-model="keyword"
        ></u-search>
      </view> -->
    </u-navbar>
    <categoryList
      :defaultActive="defaultActive"
      :categoryList="categoryList"
      @categoryMainClick="categoryMainClick"
      @categorySubClick="categorySubClick"
    ></categoryList>
  </view>
</template>
<script>
import categoryList from "@/components/SideCategoryList/category-list.vue";
export default {
  name: "index",
  components: {
    categoryList,
  },
  
  
    data() {
        return {
            defaultActive:0,
            keyword:'',
            categoryList:[
                // {name:'耗材',subCategoryList:[]},
                // {name:'设备',subCategoryList:[]},
                // {name:'石英砂',subCategoryList:[]},
                // {name:'石英制品',subCategoryList:[]},
                // {name:'原石',subCategoryList:[]},
            ]

        }
    },
	onLoad() {
		this.getcate()
	},
    methods: {
		getcate(){
			this.$.ajax(1, "POST", "index/getcate", { type: 2 }, (res) => {
			  if (res.code == 1) {
			    this.categoryList = res.data.list;
			  }
			});
		},
        categoryMainClick(){

        },
        custom(){

        },
        categorySubClick(e){
            uni.navigateTo({url:'/pages/index/classifyList?cid='+e.id})
            console.log('22')
        }
    },
    created() {

        let list = [
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
            {imgSrc:require('@/static/images/delete/st.jpg'),name:'SS00矿源印度云母伟晶矿'},
        ]
        this.categoryList.map(res =>{
            res.subCategoryList = list
        })
    },
    mounted() {

    },
}
</script>
<style lang="scss" scoped>
.navbar {
  /deep/ .u-fixed {
    z-index: 9999999;
  }
}
</style>

